// run: $exec < input
#include <iostream>
#include <algorithm>
#include <vector>

int n, m, k;
std::vector<int> alice;
std::vector<int> bob;
int ha, hb;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> m >> k;
	alice.resize(n);
	bob.resize(m);
	for (int i = 0; i < n; i++) std::cin >> alice[i];
	for (int i = 0; i < m; i++) std::cin >> bob[i];
	std::sort(alice.begin(), alice.end());
	std::sort(bob.begin(), bob.end());
	bool head_occupied = false;
	bool greater = false;
	for (int i = 0; i < m; i++) {
		if (ha >= n) { std::cout << "NO\n"; return 0; }
		if (bob[i] < alice[ha]) {
			greater = true;
			head_occupied = true;
		} else if (bob[i] == alice[ha]) {
			if (head_occupied) {
				ha++; head_occupied = false;
				if (ha == n) { std::cout << "NO\n"; return 0; }
				if (bob[i] == alice[ha]) ha++;
				else head_occupied = greater = true;
			} else
				ha++;
		} else {
			if (head_occupied) {
				ha++; head_occupied = false;
				if (ha == n) { std::cout << "NO\n"; return 0; }
				if (bob[i] >= alice[ha]) ha++;
				else head_occupied = greater = true;
			} else
				ha++;
		}
	}
	if (greater || ha < n)
		std::cout << "YES\n";
	else
		std::cout << "NO\n";
}

